package com.blogsoho.taurus.dao.builder;

import com.blogsoho.taurus.vo.UserVO;
import org.apache.ibatis.jdbc.SQL;

/**
 * Created by user on 2017/6/15.
 */
public class UserSqlBuilder {
    public String getUserByName(String name) {
        return new SQL() {{
            SELECT("id,name,email,active");
            FROM("taurus_user");
            WHERE("name = '" + name + "'");
        }}.toString();
    }

    public String addUser(UserVO user) {
        return new SQL() {{
            INSERT_INTO("taurus_user");
            VALUES("name", "#{name}");
            VALUES("email", "#{email}");
            VALUES("password", "#{password}");
            VALUES("active", "#{active}");
        }}.toString();
    }
}
